package com.colin.common.response;

import lombok.Data;

@Data
public class R <T>{
    private int status;
    private String message;
    private T data;

    public static <T> R<T> ok(T data) {
        R<T> r = new R<>();
        r.setStatus(10000);
        r.setMessage("ok");
        r.setData(data);
        return r;
    }

    public static <T> R<T> error() {
        R<T> r = new R<>();
        r.setStatus(50000);
        r.setMessage("error");
        return r;
    }

    public static <T> R<T> error(int status, String message) {
        R<T> r = new R<>();
        r.setStatus(status);
        r.setMessage(message);
        return r;
    }
}

